import { GStatic } from "../../../Core/Manager/DataPool";

const { ccclass } = cc._decorator;
@ccclass
export class SDialData extends GStatic {
    public parse(obj: any): boolean {
        for (let i = 0; i < obj.data.length; i++) {
            let raw = GStatic.addonRaw<SDialDataRaw>(obj.data[i]);
            this._data.set(raw.id, raw);
        }
        return true;
    }

    /**通过抽奖宝箱类型获取奖池 */
    public getDialByType(type: number): SDialDataRaw[] {
        let arr = [];
        this._data.forEach((v: SDialDataRaw) => {
            if (v.type == type) {
                arr.push(v);
            }
        })
        // console.log(this._data, "通过抽奖宝箱类型获取奖池", arr);
        return arr;
    }
}